package uk.org.landeg.euler.problems;

import uk.org.landeg.euler.problems.framework.AbstractProblem;
import uk.org.landeg.euler.problems.framework.ProblemLauncher;

public class Problem097 extends AbstractProblem{
	public static void main(String[] args) {
		ProblemLauncher launcher = new ProblemLauncher(new Problem097());
		launcher.solve();		
	}
	
	@Override
	public String getDescription() {
		return "Find the last ten digits of the prime number 28433 * 2^(7830457)+1";
	}
	
	@Override
	public Integer getProblemNumber() {
		return 97;
	}
	
	@Override
	public Object solve() {
		long prod = 1;
		long max = (long)1E11;
		for (int n = 0 ; n < 7830457 ; n++) {
			prod *= 2;
			if (prod > max) {
				prod -= prod/max * max;
			}
		}
		System.out.println(prod);
		prod *= 28433;
		if (prod > max) {
			prod -= prod/max * max;
		}
		prod += 1;
		return prod;

	}
}
